<!--
 * @Author: Aster lipian1004@163.com
 * @Date: 2023-12-15 10:33:01
 * @LastEditors: Aster lipian1004@163.com
 * @LastEditTime: 2023-12-15 11:38:04
 * @FilePath: \wflow-uniapp\src\pages\tabbar\user.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!-- 购物车 -->
<template>
  <view class="container">
    <aster-empty
      v-if="!isLogin"
      ref="asterEmptyRef"
      e-style="round"
      e-type="cart"
      tip="登录后才能看到商品哦~"
      btn-tip="立即登录"
      height="50vh"
      :auto="false"
      @goto="tologin"
    />
    <aster-empty
      v-else-if="empty"
      ref="asterEmptyRef"
      e-style="round"
      e-type="cart"
      tip="目前没有添加商品哦~"
      btnTip="去首页逛逛"
      height="50vh"
    />
    <view v-else>
      <!-- 顶部操作按钮 -->
      <view>1</view>
      <!-- 中间购物列表 -->
      <view>2</view>
      <!-- 底部操作按钮 -->
      <view>3</view>
    </view>
  </view>
</template>

<script setup lang="ts">
  import { ref } from 'vue';
  import AsterEmpty from '@/components/empty/aster-empty.vue';
  import { jumpLogin } from '@/utils/router/interceptor';
  import { CART_PAGE } from '@/enums/routerEnum';
  import { onLoad, onShow } from '@dcloudio/uni-app';
  import { isEmpty } from '@/utils/is';

  // 注册子组件
  const asterEmptyRef = ref();
  // 是否已登录
  const isLogin = ref<boolean>(true);
  // 购物车是否为空
  const empty = ref<boolean>(true);

  // 跳转登录页
  const tologin = () => {
    jumpLogin(CART_PAGE);
  };

  // 加载数据
  const loadData = () => {};

  onLoad(() => {
    console.log('load');
  });

  onShow(() => {
    loadData();
  });
</script>

<style scoped lang="scss"></style>
